package com.enki.cigarettes.repository;

import com.enki.cigarettes.entity.UserCouponT;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.Date;
import java.util.List;

/**
 * @author WCS.Wang
 * @version V1.0
 * @Package com.enki.cigarettes.repository
 * @Name e-cigarettes-shop-api-module
 * @Description: TODO 用户优惠券数据层
 * @date 2019-07-19
 */
public interface UserCouponTRepository extends PagingAndSortingRepository<UserCouponT, String> {

    // 优惠券数量
    long countByUserIdAndCouponTId(String userId, String couponId);

    long count(Specification specification);

    // 优惠券列表
    List<UserCouponT> findAll(Specification specification);

    // 优惠券详情
    UserCouponT findOneByIdAndUserId(String id, String userId);

    Page<UserCouponT> findAll(Specification specification, Pageable pageable);

    List<UserCouponT> findByUserIdAndDataId(String userTId, String dataId);

}
